using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GameFramework;

namespace LS
{
    public sealed class DataParamsVariable<T> : Variable<T>
        where T: DataParamsBase
    {
        /// <summary>
        /// 初始化 UnityEngine.Object 变量类的新实例。
        /// </summary>
        public DataParamsVariable()
        {
        }

        /// <summary>
        /// 从 UnityEngine.Object 到 UnityEngine.Object 变量类的隐式转换。
        /// </summary>
        /// <param name="value">值。</param>
        public static implicit operator DataParamsVariable<T>(T value)
        {
            DataParamsVariable<T> varValue = ReferencePool.Acquire<DataParamsVariable<T>>();
            varValue.Value = value;
            return varValue;
        }

        /// <summary>
        /// 从 UnityEngine.Object 变量类到 UnityEngine.Object 的隐式转换。
        /// </summary>
        /// <param name="value">值。</param>
        public static implicit operator T(DataParamsVariable<T> value)
        {
            return value.Value;
        }
    }
}
